<template>
  <div>
    <el-input v-model="value" @blur="input" />
    <!-- <el-input v-model="test" /> -->
  </div>
</template>
<script setup lang="ts">
import { computed, ref, withDefaults, useAttrs } from 'vue'
const attrs = useAttrs()
console.log(attrs, 'attrs')

// 默认值
const props = withDefaults(defineProps<{ modelValue: string }>(), {
  modelValue: 'hello'
})

const value = ref(props.modelValue)
const emit = defineEmits<{ (e: 'update:modelValue', msg: string): void }>()
const input = (val) => {
  emit('update:modelValue', val.target.value)
}

// computed
// const test = computed({
//   get: () => attrs.modelValue,
//   set: (val: any) => {
//     emit('update:modelValue', val)
//     return val
//   }
// })
</script>
<style lang="less" scoped></style>
